package com.teacher;

import com.entity.Person;
import com.entity.Course;

public class Teacher extends Person {
    private Course taughtCourse;

    public Teacher(int id, String name, String gender) {
        super(id, name, gender);
    }

    public void openCourse(Course course) {
        this.taughtCourse = course;
        System.out.println("教师" + getName() + "开设了课程《" + course.getName() + "》，课程编号：" + course.getId());
    }

    public Course getTaughtCourse() {
        return taughtCourse;
    }

    @Override
    public void printInfo() {
        super.printInfo();
        if (taughtCourse != null) {
            System.out.println("授课课程：《" + taughtCourse.getName() + "》");
        } else {
            System.out.println("暂未授课");
        }
    }
}